package com.hengtuo.student.service.base.impl;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.hengtuo.student.dao.base.BaseDao;
import com.hengtuo.student.service.base.BaseService;
@Transactional
public class BaseServiceImpl<T> implements BaseService<T>{

	@Autowired 
	protected BaseDao<T> baseDao;


	protected BaseDao<T> getBaseDao() {
		return baseDao;
	}

	@Override
	@Transactional(readOnly = true)
	public T get(String id) {
		return getBaseDao().getEntryById(id);
	}

	@Override
	public void add(T obj) {
		getBaseDao().saveEntry(obj);
	}

	@Override
	public void update(T obj) {
		getBaseDao().updateEntry(obj);
	}

	@Override
	public void delete(String id) {
		getBaseDao().deleteEntry(id);
	}

	@Override
	public Collection<T> getAll() {
		// TODO Auto-generated method stub
		return getBaseDao().getAllEntry();
	}

}
